<template>
  <leftContainer :class="{ 'show': isShow }"></leftContainer>
  <div :class="{ 'shifted': isShow,'navContainer':true }">
  <nav>
    <div class="button">
      <leftContainerButton @click="toggleShow"></leftContainerButton>
    </div>
    <router-link to="/">Home</router-link>
    <router-link to="/about">About</router-link>
    <router-link to="repositions">Reposition</router-link>
  </nav>
  <router-view />
  </div>
</template>

<script setup>
import { ref } from 'vue'
import leftContainerButton from './components/svg/leftContainerButton.vue';
import leftContainer from './components/leftContainer.vue';

let isShow = ref(false);

const toggleShow = () => {
  isShow.value = !isShow.value
}
</script>

<style>
* {
  box-sizing: border-box;
  border-radius: 2.5%;
  list-style-type: none;
}

body {
  background-color: #0d1117;
}

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  display: flex;
  flex-direction: column;
}

.button {
  width: 0%;
  padding: 10px 0px;
  text-align: center;
  overflow: visible;
  position: relative;
  left: -10px;
}

.button>svg {
  background-color: rgba(255, 255, 255, 0.25);
}

.navContainer{
  transition: margin-left 0.3s ease;
}

.navContainer.shifted {
  margin-left: 250px;
  /* 与侧边栏宽度相同 */
}

nav {
  margin: 30px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

nav a {
  width: 30%;
  margin:0 1.5%;
  padding: 10px;
  font-weight: bold;
  color: #2c3e50;
  text-decoration: none;
  background-color: rgba(255, 255, 255, 0.25);
  overflow-x: hidden;
}

nav a.router-link-exact-active {
  color: #42b983;
}


/* 如果需要内容也跟随移动 */
.router-view {
  transition: margin-left 0.3s ease;
  margin-left: 0;
}

.router-view.shifted {
  margin-left: 250px;
}
</style>
